<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <input type="text" class="tx1">
  <input type="button" value="发送验证码" class="btn1" >
  <script src="../jquery/jquery-1.12.4.min.js"></script>
  <script>
    

    $(".btn1").click(function () {
      clearInterval(set);
      var star = 10;
      $(".btn1").prop("disabled",true);
      var set = window.setInterval(function () {
      star--;
      $(".btn1").val(star);
      if (star == 0) {
        clearInterval(set);
        $(".btn1").prop("disabled",false);
        $(".btn1").val("发送验证码")
      }
      console.log(star);
    },1000)
    })
  </script>




















</body>
</html>